import React, { memo, useEffect, useState } from 'react';
import { Empty } from 'antd';

import { SINGAPORE_CODE } from '@/pages/SalaryManage/constant/countryRegion';
import { getCurrentCompanyCode, getCurrentOrgCountryCode } from '@/pages/SalaryManage/utils';

const EmptyOfSingapore = ({ organizationCode = getCurrentCompanyCode(), children }) => {
    const [emptyType, setEmptyType] = useState(false);

    useEffect(() => {
        setEmptyType(getCurrentOrgCountryCode(organizationCode) === SINGAPORE_CODE);
    }, [organizationCode]);

    return emptyType ? (
        <div style={{ padding: '50px 0' }}>
            <Empty />
        </div>
    ) : (
        children
    );
};
export default memo(EmptyOfSingapore);
